<template>
   <a-table :data-source="students">
    
    <a-table-column key="name" title="姓名" data-index="name" />
    <a-table-column key="gender" title="性别" data-index="gender" />
    <a-table-column key="age" title="年龄" data-index="age" />
    
    <a-table-column key="action" title="操作">
      <template #default="{ record }">
        <span>
          <a-button type="primary" @click="handleEdit(record._id)">修改</a-button>
          <a-divider type="vertical" />
          <a-button danger>删除</a-button>
        </span>
      </template>
    </a-table-column>
  </a-table>
</template>

<script setup>
import {defineProps} from 'vue';
import useStudentStore from '../../store/student';
const props = defineProps(['students']);
const store = useStudentStore();

function handleEdit(id){
    console.log(id);
    store.updateVisible = true;
    store.fetchStudent(id);
}
</script>

<style>

</style>